package com.firword.fileconvert.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author JingYj
 * @version 1.0
 * @date 2020/8/21
 */
@RestController
public class TestController {
    @Autowired
    JdbcTemplate jdbcTemplate;

    @RequestMapping(value = "/hello")
    public String hello() {
        String sql = "select 1+1 as aa from dual";
        // 通过jdbcTemplate查询数据库
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
        System.out.println(maps.size());
        Map<String, Object> objectMap = maps.get(0);
        Object aa = objectMap.get("aa");
        System.out.println(aa);

        return "hello word !!!" + aa.toString();
    }


}
